#include "Technique.h"
#include "FXParameter.h"

Technique::Technique(tstring name,Effect* parent):m_Name(name),m_pEffect(parent)
{
}

Technique::~Technique(void)
{
}

FXParameter* Technique::FindParameterByName(const tstring& name) const{
	ParameterIt it = m_NameMap.find(name);
	if ( it != m_NameMap.end() )
		return it->second; // second is een pointer naar de HLSParameter, first is de key.
	else
		return NULL;
}

FXParameter* Technique::FindParameterBySemantic(const tstring& semantic) const{
	ParameterIt it = m_SemanticMap.find(semantic);
	if ( it != m_SemanticMap.end() )
		return it->second;
	else 
		return NULL;
}

FXParameter* Technique::CustomizeParameterByName(const tstring& name){
	FXParameter * parameter = this->FindParameterByName(name);
	if ( parameter != NULL )
		return parameter->Clone();
	else
		return NULL;
}

FXParameter* Technique::CustomizeParameterBySemantic(const tstring& semantic){
	FXParameter * parameter = this->FindParameterBySemantic(semantic);
	if ( parameter != NULL)
		return parameter->Clone();
	else
		return NULL;
}

void Technique::AddNamedParameter(FXParameter * param)
{
	m_NameMap[param->GetName()]=param;
}

void Technique::AddSemanticParameter(FXParameter * param)
{
	m_SemanticMap[param->GetSemantic()]=param;
}